package cn.donting.jme.expansion.attribute.lmpl;

import cn.donting.jme.expansion.attribute.ValueChangeListener;
import cn.donting.jme.swing.JIntegerTextField;
import java.awt.*;


public class IntegerAttribute extends AbsLineAttribute<Integer, JIntegerTextField> implements ValueChangeListener<Integer> {

    public IntegerAttribute(String label) {
        super(new JIntegerTextField());
        inputComponent.setMaximumSize(new Dimension(100,50));
        setTitle(label);
        inputComponent.addValueChangeListener(this);
    }

    public void stepSize(int step) {
        inputComponent.setStepSize(step);
    }
    public void setMaxValue(int mixValue){
        inputComponent.setMaxValue(mixValue);
    }

    public void setMixValue(int minValue){
        inputComponent.setMinValue(minValue);
    }

    @Override
    public void setValue(Integer value) {
        inputComponent.setValue(value);
    }


    @Override
    protected Integer getInputValue() {
        return inputComponent.getValue();
    }

    @Override
    public void change(Integer newValue) {
        valueChange(newValue);
    }
}
